function Employee(name){
    this.name = name;
    this.say = function(){
        console.log("I am employee:"+name)
    }
}

function EmployeeFactory(){
    this.create = function(name){
      return new Employee(name)
    }
}

function Vendor(name){
    this.name = name;
    this.say = function(){
        console.log("I am vendor:"+name)
    }
}

function VendorFactory(){
    this.create = function(name){
      return new Vendor(name)
    }
}


var persons = []
employeeFactory = new EmployeeFactory();
vendorFactory = new VendorFactory();
persons.push(employeeFactory.create("tim"))
persons.push(employeeFactory.create("mac"))
persons.push(employeeFactory.create("heelo"))
persons.push(vendorFactory.create("jin"))
persons.push(vendorFactory.create("red"))
persons.push(vendorFactory.create("jidwn"))

persons.forEach(person=>{
    person.say()
})